package com.cancan.demo.apidebouncing.response;


/**
 * 结果返回类
 *
 * @author czchen
 * @version 1.0
 * @date 2020/6/20 19:23
 */
public class JsonResult extends Result {

    public JsonResult() {
    }

    public JsonResult(int code, String msg, Object data) {
        super(code, msg, data);
    }

    public JsonResult(int code, String msg) {
        super(code, msg);
    }

    public static JsonResult success() {
        return new JsonResult(HttpCodeEnum.OK.getCode(),null);
    }

    public static JsonResult failed() {
        return new JsonResult(HttpCodeEnum.BAD_REQUEST.getCode(),null,null);
    }

    public static JsonResult success(Object data) {
        return new JsonResult(HttpCodeEnum.OK.getCode(),null,data);
    }

    public static JsonResult success(String msg,Object data) {
        return new JsonResult(HttpCodeEnum.OK.getCode(),msg,data);
    }

    public static JsonResult failed(String msg,Object data) {
        return new JsonResult(HttpCodeEnum.BAD_REQUEST.getCode(),msg,data);
    }
}
